set nocompatible

" allow multibyte chars for testing that functionality
set encoding=utf-8

" set dark background so we can test background colors
set background=dark
hi Normal guibg=black ctermbg=black guifg=white ctermfg=white

" MRU is pretty common, let's not screw up the history every time we run the
" test
let g:loaded_mru = 1

" set up syntax highlighting...hopefully vim syntax doesn't change too
" drastically too often
syntax on
filetype on
filetype plugin on

" can't create diffs without a diffexpr on Windows so here's mine from my .vimrc
" TODO: figure out if a diffexpr is needed on Linux and what it should be
if has('win32')
  set diffexpr=MyDiff()
  function! MyDiff()
    if filereadable($VIMRUNTIME.'\diff.exe')
      let diff_loc = $VIMRUNTIME.'\'
    elseif filereadable('C:\Program Files (x86)\vim\vim73\diff.exe')
      let diff_loc = 'C:\Program Files (x86)\vim\vim73\'
    elseif filereadable('C:\Program Files\vim\vim73\diff.exe')
      let diff_loc = 'C:\Program Files\vim\vim73\'
    else
      let diff_loc = ''
    endif
    echomsg "using diff at" diff_loc

    " set up basic options
    let opt = '-a --binary '
    if &diffopt =~ 'icase'
      let opt = opt . '-i '
    endif
    if &diffopt =~ 'iwhite'
      let opt = opt . '-b '
    endif

    " surround with quotes if spaces occur in file name
    let arg1 = v:fname_in
    if arg1 =~ ' '
      let arg1 = '"' . arg1 . '"'
    endif
    let arg2 = v:fname_new
    if arg2 =~ ' '
      let arg2 = '"' . arg2 . '"'
    endif
    let arg3 = v:fname_out
    if arg3 =~ ' '
      let arg3 = '"' . arg3 . '"'
    endif

    let eq = ''
    if diff_loc =~ ' '
      let cmd = '"' . diff_loc . 'diff"'
    else
      let cmd = diff_loc . 'diff'
    endif
    silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
    echomsg '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  endfunction
endif
 
" keep output the same for everyone
set diffopt&

" tests should be non-interactive
set nomore

" need to assume directory won't be changing
set noacd

" try to cause some trouble
set nowrapscan
set nomagic
nnoremap / :qa!<CR>
nnoremap A :qa!<CR>
nnoremap I :qa!<CR>
nnoremap j :qa!<CR>
nnoremap k :qa!<CR>

" only work with unix line endings
set fileformats=unix

" to keep file names the same between systems (also can cause trouble in Windows
" if not handled in scripts properly)
set shellslash

" turned off plugins for this test, source the plugin we need
runtime plugin/tohtml.vim

" set up same highlighting for every system...Linux/Windows defaults differ
hi Normal  guifg=#ffffff guibg=#000000
hi Folded  guifg=#00ffff guibg=#808080
hi FoldColumn guifg=#00ffff guibg=#c0c0c0
hi Comment  guifg=#80a0ff
hi Type  guifg=#60ff60 gui=bold
hi Conceal  guifg=#e0e0e0 guibg=#808080
hi Statement  guifg=#ffff60 gui=bold
hi Constant  guifg=#ffa0a0
hi Special  guifg=#ffa500
hi PreProc  guifg=#ff80ff
hi Todo  guifg=#0000ff guibg=#ffff00
hi Normal  guifg=#ffffff guibg=#000000
hi DiffAdd  guibg=#000080
hi DiffChange  guibg=#800080
hi DiffDelete  guifg=#0000ff guibg=#008080 gui=bold
hi DiffText  guibg=#ff0000 gui=bold
